import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, Matches } from 'class-validator';
import { UserDto } from './user.dto';

export class CreateUserDto extends UserDto {
  @ApiProperty({ required: true, description: '手机号码' })
  @IsString({ message: '用户名必须为字符类型' })
  @IsNotEmpty({ message: '用户名不能为空' })
  @Matches(/^[a-zA-Z.0-9]{4,20}$/, { message: '用户名由数字和字母组成，且4-20位!!' })
  readonly username: string;
}
